 
checkCookiepop();

function getCookiepop(c_name) {
    var i, x, y, ARRcookies = document.cookie.split(";");
    for (i = 0; i < ARRcookies.length; i++) {
        x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
        y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
        x = x.replace(/^\s+|\s+$/g, "");
        if (x == c_name) {
            return unescape(y);
        }
    }
}

function setCookiepop(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}

function checkCookiepop() {
    var popup = getCookiepop("popup");
    if (popup != null && popup != "") {
        //alert("Welcome again " + popup);

//        if (popup == 0) {
//            setCookie("popup", 1, 365);
//            var ads300 = '<script  src="http://tag.contextweb.com/TagPublish/getjs.aspx?action=VIEWAD&cwrun=200&cwadformat=300X250&cwpid=550231&cwwidth=300&cwheight=250&cwpnet=1&cwtagid=138310"></script>';
//        }
//        if (popup == 1) {
//            setCookie("popup", 2, 365);
//            var ads300 = '<script  src="http://tag.contextweb.com/TagPublish/getjs.aspx?action=VIEWAD&cwrun=200&cwadformat=300X250&cwpid=550231&cwwidth=300&cwheight=250&cwpnet=1&cwtagid=138310"></script>';

//        }
//        if (popup == 2) {
//            setCookie("popup", 0, 365);
//            var ads300 = '<script  src="http://tag.contextweb.com/TagPublish/getjs.aspx?action=VIEWAD&cwrun=200&cwadformat=300X250&cwpid=550231&cwwidth=300&cwheight=250&cwpnet=1&cwtagid=138310"></script>';
//        }

    }
    else {
        popup = "1";
        if (popup != null && popup != "") {
            setCookiepop("popup", popup, 365);
            
            popup_hit = 0;
            
                document.body.onclick = function () {
                if (popup_hit == 0) {
                newWindow = window.open('http://adf.ly/Gmrti', 'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width=60, height=40, left = 30, top = 10');
                popup_hit = popup_hit + 1;
                 } 
                setTimeout('closeWin(newWindow)', 15000); // delay 15 seconds before closing
           
        }
        function closeWin(newWindow) {
           
                newWindow.close(); // close small window and depart

            }
        }

    }
}

